package com.markerhub.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.markerhub.entity.TPayOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.markerhub.povo.TPayOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 刘佳明
 * @since 2022-01-11
 */
@Mapper
public interface TPayOrderMapper extends BaseMapper<TPayOrder> {

//    @Select("<script>  SELECT a.*,b.number,b.address,c.money,c.function_type,d.username,e.project_name,f.*," +
//            "(CASE f.defarystatus  WHEN '0' THEN '未支付' WHEN '1' THEN '支付失败' WHEN '2' THEN '支付成功' WHEN '3' THEN '退款中' WHEN '4' THEN '退款OK' WHEN '5' THEN '退款失败' ELSE '其他' END ) as Defary,\n" +
//            "(CASE f.defarytype  WHEN '0' THEN '微信支付' WHEN '1' THEN '支付宝' WHEN '2' THEN '余额' ELSE '其他' END ) as defarytypes\n" +
//            "        FROM t_pay_order a, t_facility_base b, t_facility_function c, sys_user d, t_project_base e ,t_pay_defary f\n" +
//            "        where a.userobject=d.id and a.baseid =b.id and c.functionid=a.functionid and b.projectid=e.projectid and a.orderid=f.orderid  " +
//            "<if test='dateup!=null and dateup!=\"\"'> " +
//            " AND a.defarytime &gt;= #{dateup} " +
//            "</if>" +
//            "<if test='datedown!=null and datedown!=\"\"'> " +
//            " AND a.defarytime &lt;= #{datedown} " +
//            "</if>" +
//            "<if test='orderNumber!=null  and orderNumber!=\"\"'>and a.order_number=#{orderNumber} </if>" +
//            "<if test='number!=null  and number!=\"\"'>and b.number=#{number} </if>" +
//            "<if test='defarystatus!=null  and defarystatus!=\"\"'>and f.defarystatus=#{defarystatus} </if>" +
//            "<if test='projectid!=null  and projectid!=\"\"'>and b.projectid=#{projectid} </if>" +
//            " <if test='pages &gt;= 0 and limit &gt; 0'>limit #{pages}, #{limit}</if>"+
//            "</script>")
    List<TPayOrderVo> getOrderList(@Param("pages") Integer pages, @Param("limit") Integer limit, @Param("number") String number, @Param("orderNumber") String orderNumber, @Param("projectid") String projectid, @Param("dateup") LocalDate dateup, @Param("datedown")LocalDate datedown , @Param("defarystatus") String defarystatus, @Param("Userids") Integer Userids);



    List<TPayOrder> getlist();
}
